package com.kma.summer2012.client.events.manager;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.kma.summer2012.shared.model.UICrumbsToolItem;

/**
 * Created with IntelliJ IDEA.
 * User: Администратор
 * Date: 22.02.13
 * Time: 12:14
 * To change this template use File | Settings | File Templates.
 */
public class AddToolEvent extends GwtEvent<AddToolEvent.AddToolEventHandler> {
    private static Type<AddToolEventHandler> TYPE = new Type<AddToolEventHandler>();
    private final UICrumbsToolItem uiTool;

    public AddToolEvent(UICrumbsToolItem uiTool) {
        this.uiTool = uiTool;
    }

    public UICrumbsToolItem getUiTool() {
        return uiTool;

    }

    @Override
    public Type<AddToolEventHandler> getAssociatedType() {
        return TYPE;
    }

    public static Type<AddToolEventHandler> getType() {
        return TYPE;
    }

    @Override
    protected void dispatch(AddToolEventHandler addToolEventHandler) {
        addToolEventHandler.onAddTool(this);
    }


    public interface AddToolEventHandler extends EventHandler {
        void onAddTool(AddToolEvent event);
    }
}
